<template>
  <div class="container">
    <el-drawer
      :title="titleCon"
      :visible.sync="showCompanyDrawer"
      direction="rtl"
      size="50%"
      :before-close="handleClose"
    >
      <div class="main">
        <el-form
          :model="formData"
          ref="formData"
          label-width="130px"
          class="demo-formData"
        >
          <table cellspacing="0" cellpadding="0">
            <tbody>
              <tr>
                <td class="title keyColor">企业名称</td>
                <td>{{ formData.companyName || '--' }}</td>
                <td class="title keyColor">统一社会信用代码</td>
                <td>{{ formData.uscc || '--' }}</td>
              </tr>
              <tr>
                <td class="title keyColor">注册日期</td>
                <td>{{ formData.registerDate || '--' }}</td>
                <td class="title keyColor">企业注册地区编码</td>
                <td>{{ formData.areaCode || '--' }}</td>
              </tr>
              <tr>
                <td class="title">单位性质</td>
                <td class="general">{{ formData.character || '--' }}</td>
                <td class="title">企业营业地址</td>
                <td>{{ formData.bizAreaName || '--' }}</td>
              </tr>
              <tr>
                <td class="title">法定代表人姓名</td>
                <td>{{ formData.legalMan || '--' }}</td>
                <td class="title">法定代表人证件号码</td>
                <td>{{ formData.legalManIdCardNum || '--' }}</td>
              </tr>
              <tr>
                <td class="title">办公电话</td>
                <td>{{ formData.officePhone || '--' }}</td>
                <td class="title">联系人姓名</td>
                <td>{{ formData.linkMan || '--' }}</td>
              </tr>
              <tr>
                <td class="title">联系人办公电话</td>
                <td>{{ formData.linkTel || '--' }}</td>
                <td class="title">企业联系邮箱</td>
                <td>{{ formData.email || '--' }}</td>
              </tr>
            </tbody>
          </table>
        </el-form>
      </div>
    </el-drawer>
  </div>
</template>

<script>
export default {
  name: 'seeDetaildrawer',
  data() {
    return {
      titleCon: '企业详情',
      showCompanyDrawer: true,
      formData: {},
    }
  },
  props: {
    id: {
      type: String,
      default: '',
    },
  },
  created() {
    this.getDetail()
  },
  methods: {
    handleClose() {
      this.$emit('closeDetail')
    },
    getDetail() {
      this.axios({
        method: 'post',
        url: 'api-out/sz/corp/detail',
        data: {
          id: this.id,
        },
      })
        .then((response) => {
          this.formData = response.data.result
        })
        .catch((error) => {
          this.$message.error('数据获取失败')
        })
    },
  },
}
</script>

<style scoped lang="less">
.container {
  .main {
    padding: 0 24px 24px;
    height: calc(100% - 67px);
    color: #333;
    font-size: 14px;
  }
}
form.el-form.demo-formData {
  width: 100%;
  display: inline-block;
  text-align: left;
  padding-bottom: 24px;
  .a_link {
    color: #00a0e9;
  }
  table {
    width: 100%;
    border-top: 1px solid #d5dfe8;
    border-left: 1px solid #d5dfe8;
    td {
      padding: 16px 18px;
      border-bottom: 1px solid #d5dfe8;
      border-right: 1px solid #d5dfe8;
    }
    .title {
      width: 177px;
      background-color: #f5f7fc;
      font-weight: 500;
      text-align: right;
    }
    .general {
      color: #6dd400;
    }
    .import {
      color: #fa6400;
    }
    .serious {
      color: #e02020;
    }
  }
}
.el-main .el-form-item {
  margin-bottom: 20px;
}
/deep/ .el-drawer__body {
  overflow: auto !important;
}
.keyColor {
  color: #e02020;
}
</style>
